import Vue from "vue"
import Router from "vue-router"
// import ServiceManagement from './routes/ServiceManagement'
// import serviceExamine from './routes/serviceExamine'
// import group from './routes/group'
// const innerLayout = () =>
//   import('@/views/layout/inner_layout')
const Layout = () => import("@/views/layout/layout")
// 横向nav时，打开下句
// const Layout = () =>
//   import ("@/views/layout/layout_horizontal");

Vue.use(Router)

export const constantRouterMap = [
  // ...ServiceManagement,
  // ...serviceExamine,
  // ...group,
  {
    path: "/login",
    component: () => import("@/views/login/login"),
    hidden: true
  },
  {
    path: "/sso/logout",
    hidden: true,
    component: () => import("@/views/login/logout")
  },
  {
    path: "/404",
    component: () => import("@/views/errorPage/404"),
    hidden: true
  },
  {
    path: "/",
    component: Layout,
    redirect: "/standard",
    hidden: true
  },
  {
    // 稽核数据统计
    path: '/standard',
    component: Layout,
    redirect: '/standard/test',
    meta: {
      title: '标准规范',
      icon: 'el-icon-star-off'
    },
    children: [
      {
        path: 'standard',
        component: () => import('@/views/dataStatistics/dataStatistics'),
        name: 'standard',
        meta: {
          title: '标准规范',
          icon: 'standard'
        }
      },
      {
        path: 'test',
        component: () => import('@/views/test/test'),
        name: 'test',
        meta: {
          title: '测试页',
          icon: 'test'
        }
      }
    ]
  },

  // {
  //   // 人工录入
  //   path: "/manual",
  //   component: Layout,
  //   redirect: "/manual/entryList",
  //   meta: {
  //     title: "人工录入",
  //     icon: "el-icon-star-off"
  //   },
  //   children: [
  //     {
  //       path: "entryList",
  //       component: () =>
  //         import("@/views/manual/entryList.vue"),
  //       name: "entryList",
  //       meta: {
  //         title: "人工录入列表",
  //         icon: ""
  //       }
  //     },
  //     {
  //       path: "settingDataList",
  //       component: () =>
  //         import("@/views/manual/settingDataList.vue"),
  //       name: "settingDataList",
  //       meta: {
  //         title: "配置表单",
  //         icon: ""
  //       }
  //     },
  //     {
  //       path: "addDataList",
  //       component: () =>
  //         import("@/views/manual/addDataList.vue"),
  //       name: "addDataList",
  //       meta: {
  //         title: "新增数据表",
  //         icon: ""
  //       }
  //     }
  //   ]
  // },
  // 用户管理
  // {
  //   path: '/systemManage',
  //   component: Layout,
  //   redirect: '/systemManage/systemManageXzqh',
  //   meta: {
  //     title: '系统管理',
  //     icon: 'el-icon-star-off'
  //   },
  //   children: [
  //     {
  //       path: 'systemManageUserManage',
  //       component: () =>
  //         import('@/views/systemManage/userManage/user'),
  //       name: 'systemManageUserManage',
  //       meta: {
  //         title: '用户管理',
  //         icon: 'systemManageUserManage'
  //       }
  //     },
  //     {
  //       path: 'role',
  //       component: () =>
  //         import('@/views/manage/role'),
  //       name: 'role',
  //       meta: {
  //         title: '角色管理',
  //         icon: 'role'
  //       }
  //     },
  //     {
  //       path: 'source',
  //       component: () =>
  //         import('@/views/manage/source'),
  //       name: 'source',
  //       meta: {
  //         title: '角色管理',
  //         icon: 'source'
  //       }
  //     }
  //   ]
  // },

  {
    // 建设中
    path: "/build",
    component: Layout,
    redirect: "/build/building",
    meta: {
      title: "任务管理",
      icon: "el-icon-star-off"
    },
    children: [
      {
        path: "building",
        component: () =>
          import("@/views/errorPage/building"),
        name: "building",
        meta: {
          title: "建设中",
          icon: ""
        }
      }
    ]
  },
  {
    path: "*",
    redirect: "/404",
    hidden: true
  }
]
export default new Router({
  // mode: "history", // 浏览模式切换
  scrollBehavior: () => {
    // eslint-disable-next-line no-unused-expressions
    document.getElementsByClassName("el-scrollbar__wrap")[0]
      ? (document.getElementsByClassName("el-scrollbar__wrap")[0].scrollTop = 0)
      : ""
    return {
      y: 0
    }
  },
  routes: constantRouterMap
})
